package jp.co.piratealliance.pirateAllianceWeb.web.action.com;

import java.util.List;

import org.apache.struts2.ServletActionContext;

import jp.co.piratealliance.pirateAllianceWeb.common.base.BaseAction;
import jp.co.piratealliance.pirateAllianceWeb.dto.com.AreaInfoDto;
import jp.co.piratealliance.pirateAllianceWeb.service.com.AreaService;
/**
 * copyright pirate alliance team 2014
 *
 * @author songyong
 */
public class AreaWebAction extends BaseAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private List<AreaInfoDto> areaInfoDto;
	private AreaService areaService;
	
	public List<AreaInfoDto> getAreaInfoDto() {
		return areaInfoDto;
	}
	public void setAreaInfoDto(List<AreaInfoDto> areaInfoDto) {
		this.areaInfoDto = areaInfoDto;
	}
	public AreaService getAreaService() {
		return areaService;
	}
	public void setAreaService(AreaService areaService) {
		this.areaService = areaService;
	}
	
	public String areaInfoInit(){
		this.areaInfoDto=this.areaService.selectAreaInfoInit();
		return SUCCESS;
	}
	
	public String areaChoose(){
	String parent_id = ServletActionContext.getRequest().getParameter("parent_id");
	this.areaInfoDto=this.areaService.selectAreaByParentId(parent_id);
		return SUCCESS;
	}
	//add by hmh
	public String findAreaParentId(){
		String child_id= ServletActionContext.getRequest().getParameter("childId");
		this.areaInfoDto=this.areaService.selectAreaIById(child_id);
		return SUCCESS;
	}
	
	public String areaChooseById(){
		String parent_id = ServletActionContext.getRequest().getParameter("parent_id");	
		this.areaInfoDto=this.areaService.selectAreaIById(parent_id);
		return SUCCESS;
	}
}

